<?php

namespace app\modules\admin\forms\merchant;

use app\common\forms\BaseForm;

class MerchantCredentialForm extends BaseForm{

    public $username;

    public function scenarios()
    {
        return [
            'create'=>[
                'username'
            ],
            'update'=>[
                'username'
            ],
        ];
    }

    public function rules()
    {
        return [
            ['username','required','on'=>['create'],'message'=>\Yii::t("app","账号不能为空")],
            ['username','string','min'=>6,'tooShort'=>\Yii::t("app","登录账号不能少于6位")],
            ['username','unique','on'=>['create'],'targetClass'=>'app\models\MerchantCredential','message'=>\Yii::t("app","用户名已存在")],
        ];
    }
}